package com.siyuanren.gcocp.enums.wx;

import lombok.Getter;
import org.apache.commons.lang3.StringUtils;

import java.util.Objects;

/**
 * @author guwr
 */
@Getter
public enum CountKeyEnum{
    /**
     *
     */
    SHARE_COUNT("课程分享人数", 1);

    private String desc;
    private int value;

    CountKeyEnum(String desc, int value) {
        this.desc = desc;
        this.value = value;
    }

    public static CountKeyEnum getModel(int value) {
        for (CountKeyEnum he : CountKeyEnum.values()) {
            if (Objects.equals(value, he.getValue())) {
                return he;
            }
        }
        return null;
    }

    public static String getEnumDesc(Integer value) {
        if (value == null) {
            return StringUtils.EMPTY;
        }
        CountKeyEnum model = getModel(value);
        if (model == null) {
            return StringUtils.EMPTY;
        }
        return model.getDesc();
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public void setValue(int value) {
        this.value = value;
    }
}